import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userInfo: sessionStorage.getItem("userInfo"),
    memberInfo: sessionStorage.getItem("memberInfo"),
    businessInfo: sessionStorage.getItem("businessInfo"),
    wxSdk: sessionStorage.getItem("wxjsdk"),
    loadingEnable: false,
    NativeShare: null,
  },
  mutations: {
    SAVEUSERINFO: function (state, data) {
      state.userInfo = data
      sessionStorage.setItem("userInfo", data)
    },
    SAVEMEMBERINFO: function (state, data) {
      state.memberInfo = data
      sessionStorage.setItem("memberInfo", data)
    },
    SAVEBUSINESSINFO: function (state, data) {
      state.businessInfo = data;
      sessionStorage.setItem('business', JSON.stringify(data))
    },
    STORAGEWXJSAPI: function (state, data) {
      state.wxSdk = data;
      sessionStorage.setItem('wxjsdk', data)
    },
    STORAGENATIVESHARE: function (state, data) {
      state.NativeShare = data;
    },
    SHOWLODING: function (state, data) {
      state.loadingEnable = data
    }
  },
  actions: {
  },
  modules: {
  }
})
